FROM maven:3.6.0-jdk-8-slim as build

#指定构建过程中的工作目录
WORKDIR /app

#将src目录下的所有文件，拷贝到工作目录下src目录下
COPY src /app/src

COPY pom.xml /app

RUN mvn -f /app/pom.xml clean package

FROM alpine

ENV MYSQL_HOST 10.6.103.46
ENV MYSQL_USERNAME root
ENV MYSQL_PASSWORD litie1102@
ENV DATABASE_NAME molan_music

RUN apk add --update --no-cache openjdk8-jre-base \
    && rm -f /var/cache/apk/* \

WORKDIR /app

COPY --from=build /app/target/molan_music-0.0.1.jar .

EXPOSE 80

CMD ["java","-jar","/app/molan_music-0.0.1.jar"]